﻿using System;
using System.Collections.Generic;
using System.Text;
using NetworkLib.Utilities;

namespace PokemonBattle.BattleNetwork
{
    public enum BattleRule : int
    {
        PPUp = 151839857,
        Random = -353152975,
        WrongInput = -1
    }

    public static class BattleRuleHelper
    {
        public static BattleRule ReadFromByteArray(ByteArray byteArray)
        {
            int val = byteArray.ReadInt();
            return Parse(val);
        }
        public static BattleRule Parse(int val)
        {
            foreach (int value in Enum.GetValues(typeof(BattleRule)))
            {
                if (value == val) return (BattleRule)value;
            }
            return BattleRule.WrongInput;
        }
        public static void WriteToByteArray(ByteArray byteArray, BattleRule value)
        {
            byteArray.WriteInt((int)value);
        }
    }
}
